package com.frp.protocol;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 客户端登录消息
 */
public class LoginMessage extends Message {
    @JsonProperty("version")
    private String version;
    
    @JsonProperty("hostname")
    private String hostname;
    
    @JsonProperty("os")
    private String os;
    
    @JsonProperty("arch")
    private String arch;
    
    @JsonProperty("user")
    private String user;
    
    @JsonProperty("timestamp")
    private long timestamp;
    
    @JsonProperty("privilege_key")
    private String privilegeKey;
    
    @JsonProperty("run_id")
    private String runId;
    
    @JsonProperty("pool_count")
    private int poolCount;
    
    public LoginMessage() {
        super(MessageType.Login);
    }
    
    public LoginMessage(String version, String hostname, String os, String arch, 
                       String user, String privilegeKey, String runId, int poolCount) {
        super(MessageType.Login);
        this.version = version;
        this.hostname = hostname;
        this.os = os;
        this.arch = arch;
        this.user = user;
        this.timestamp = System.currentTimeMillis() / 1000;
        this.privilegeKey = privilegeKey;
        this.runId = runId;
        this.poolCount = poolCount;
    }
    
    // Getters and Setters
    public String getVersion() { return version; }
    public void setVersion(String version) { this.version = version; }
    
    public String getHostname() { return hostname; }
    public void setHostname(String hostname) { this.hostname = hostname; }
    
    public String getOs() { return os; }
    public void setOs(String os) { this.os = os; }
    
    public String getArch() { return arch; }
    public void setArch(String arch) { this.arch = arch; }
    
    public String getUser() { return user; }
    public void setUser(String user) { this.user = user; }
    
    public long getTimestamp() { return timestamp; }
    public void setTimestamp(long timestamp) { this.timestamp = timestamp; }
    
    public String getPrivilegeKey() { return privilegeKey; }
    public void setPrivilegeKey(String privilegeKey) { this.privilegeKey = privilegeKey; }
    
    public String getRunId() { return runId; }
    public void setRunId(String runId) { this.runId = runId; }
    
    public int getPoolCount() { return poolCount; }
    public void setPoolCount(int poolCount) { this.poolCount = poolCount; }
}